From 67bf2ce6d57e9f359e2c9a2dc8d45101792a8f98 Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Fri, 28 Feb 2020 14:16:06 +0100 Subject: [PATCH] Check for mke2fs in sbin dirs, configure path into linuxdisk plugin Gbp-Pq: Name 0004-Check-for-mke2fs-in-sbin-dirs-configure-path-into-li.patch --- configure.ac | 9 ++++++--- plugins/linuxdisk/filesystem.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 40e54eb..848ad5c 100644 --- a/configure.ac +++ b/configure.ac @@ -482,13 +482,16 @@ dnl Check for mke2fs -d (used by linuxdisk plugin). There are two dnl possible outcomes that we care about: (1) We have mke2fs and dnl it supports the -d option. (2) We either don't have mke2fs dnl or it's too old to support the -d option (eg. on RHEL 7). +AC_PATH_PROG([MKE2FS], [mke2fs], [no], [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_MSG_CHECKING([for $MKE2FS supporting the -d option]) mke2fs_with_d=no -AC_MSG_CHECKING([for mke2fs supporting the -d option]) -AS_IF([mke2fs -V >/dev/null 2>&1], [ - AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [ +AS_IF([test $MKE2FS != no], [ + AS_IF([LANG=C $MKE2FS -d 2>&1 | grep -sq "option requires an argument"], [ mke2fs_with_d=yes + AC_DEFINE_UNQUOTED([MKE2FS], ["$MKE2FS"], [path to mke2fs binary]) ]) ]) + AC_MSG_RESULT([$mke2fs_with_d]) AM_CONDITIONAL([HAVE_MKE2FS_WITH_D],[test "x$mke2fs_with_d" = "xyes"]) diff --git a/plugins/linuxdisk/filesystem.c b/plugins/linuxdisk/filesystem.c index a9f7064..e0b02b1 100644 --- a/plugins/linuxdisk/filesystem.c +++ b/plugins/linuxdisk/filesystem.c @@ -219,7 +219,7 @@ mke2fs (const char *filename) return -1; } - fprintf (fp, "mke2fs -q -F -t %s ", type); + fprintf (fp, MKE2FS " -q -F -t %s ", type); if (label) { fprintf (fp, "-L "); shell_quote (label, fp); -- 2.30.2